<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>

    <!-- Basic Page Needs
    ================================================== -->
    <title>Hireo</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <!-- CSS
    ================================================== -->
    <link rel="stylesheet" href="/css/style.css">
    <link rel="stylesheet" href="/css/colors/blue.css">

</head>
<body class="gray">

<!-- Wrapper -->
<div id="wrapper">

    <!-- Header Container
    ================================================== -->
    <header id="header-container" class="fullwidth dashboard-header not-sticky">

        <!-- Header -->
        <div id="header">
            <div class="container">

                <!-- Left Side Content -->
                <div class="left-side">

                    <!-- Logo -->
                    <div id="logo">
                        <a href="/index"><img src="/images/logo.png" alt=""></a>
                    </div>

                </div>
                <!-- Left Side Content / End -->


                <!-- Right Side Content / End -->
                <div class="right-side">

                    <!-- User Menu -->
                    <div class="header-widget">

                        <!-- Messages -->
                        <div class="header-notifications user-menu">
                            <div class="header-notifications-trigger">
                                <a href="#"><div class="user-avatar status-online"><img th:src="${session.employer.headImg}" alt=""></div></a>
                            </div>

                            <!-- Dropdown -->
                            <div class="header-notifications-dropdown">

                                <!-- User Status -->
                                <div class="user-status">

                                    <!-- User Name / Avatar -->
                                    <div class="user-details">
                                        <div class="user-avatar status-online"><img th:src="${session.employer.headImg}" alt=""></div>
                                        <div class="user-name">
                                            [[${session.employer.username}]]<span>雇主</span>
                                        </div>
                                    </div>

                                </div>

                                <ul class="user-menu-small-nav">
                                    <li><a href="/employer/dashboard"><i class="icon-material-outline-dashboard"></i>个人中心</a></li>
                                    <li><a href="/employer/logout"><i class="icon-material-outline-power-settings-new"></i> 退出登录</a></li>
                                </ul>

                            </div>
                        </div>

                    </div>
                    <!-- User Menu / End -->
                    </span>

                </div>
                <!-- Right Side Content / End -->

            </div>
        </div>
        <!-- Header / End -->

    </header>
    <div class="clearfix"></div>
    <!-- Header Container / End -->


    <!-- Dashboard Container -->
    <div class="dashboard-container">

        <!-- Dashboard Sidebar
        ================================================== -->
        <div class="dashboard-sidebar">
            <div class="dashboard-sidebar-inner" data-simplebar>
                <div class="dashboard-nav-container">

                    <!-- Navigation -->
                    <div class="dashboard-nav">
                        <div class="dashboard-nav-inner">

                            <ul>
                                <li><a href="/employer/dashboard"><i class="icon-material-outline-dashboard"></i> 首页</a></li>
                                <li><a href="#"><i class="icon-material-outline-assignment"></i> 任务</a>
                                    <ul>
                                        <li><a href="/employer/myTasks">管理任务</a></li>
                                        <li><a href="/employer/task/post">发布任务</a></li>
                                    </ul>
                                </li>
                                <li  class="active active-submenu" ><a href="#"><i class="icon-material-outline-settings"></i> 个人设置</a>
                                    <ul>
                                        <li  class="active"><a href="/employer/settings/base">基本信息</a></li>
                                        <li><a href="/employer/settings/password">修改密码</a></li>
                                    </ul>
                                </li>
                                <li><a href="/employer/logout"><i class="icon-material-outline-power-settings-new"></i> 退出登录</a></li>
                            </ul>


                        </div>
                    </div>
                    <!-- Navigation / End -->

                </div>
            </div>
        </div>
        <!-- Dashboard Sidebar / End -->


        <!-- Dashboard Content
        ================================================== -->
        <div class="dashboard-content-container" data-simplebar>
            <div class="dashboard-content-inner" >

                <!-- Dashboard Headline -->
                <div class="dashboard-headline">
                    <h3>个人设置</h3>
                </div>
                <form method="post" action="/employer/settings/base/save" onsubmit="return updateBase()">
                    <input th:hidden="true" th:value="${session.employer.id}" name="id" />
                      <!-- Row -->
                    <div class="row">
                            <!-- Dashboard Box -->
                            <div class="col-xl-12">
                                    <div class="dashboard-box margin-top-0">

                                        <!-- Headline -->
                                        <div class="headline">
                                            <h3><i class="icon-material-outline-account-circle"></i> 我的账户</h3>
                                        </div>

                                        <div class="content with-padding padding-bottom-0">

                                            <div class="row">
                                                <div class="col-auto">
                                                    <div class="avatar-wrapper" data-tippy-placement="bottom" title="修改头像">
                                                        <img class="profile-pic" th:src="${employer.headImg}" alt="" />
                                                        <div class="upload-button"></div>
                                                        <input id="dropzFile" onchange="updateHeadImg()" name="dropzFile" class="file-upload" type="file" accept="image/*"/>
                                                    </div>
                                                    <input id="headImg" name="headImg" th:hidden="true" th:value="${employer.headImg}"/>
                                                </div>

                                                <div class="col">
                                                    <div class="row">

                                                        <div class="col-xl-6">
                                                            <div class="submit-field">
                                                                <h5>用户名</h5>
                                                                <input readonly="true" id="username" name="username" type="text" class="with-border" placeholder="请填写您的用户名" th:value="${employer.username}" required>
                                                            </div>
                                                        </div>

                                                        <div class="col-xl-6">
                                                            <div class="submit-field">
                                                                <h5>手机号</h5>
                                                                <input id="phone" name="phone" type="text" class="with-border" placeholder="请填写您的手机号" th:value="${employer.phone}" required>
                                                            </div>
                                                        </div>

                                                        <div class="col-xl-12">
                                                            <div class="submit-field">
                                                                <h5>邮箱</h5>
                                                                <input name="email" type="email" class="with-border" placeholder="请填写您的邮箱" th:value="${employer.email}" required>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                        </div>
                                    </div>
                            </div>


                            <!-- Button -->
                            <div class="col-xl-12">
                                <button type="submit" class="button ripple-effect big margin-top-30">保存更改</button>
                            </div>
                    </div>
                <!-- Row / End -->
                </form>

                <!-- Footer -->
                <div class="dashboard-footer-spacer"></div>
                <div class="small-footer margin-top-15">
                    <div class="small-footer-copyrights">
                        @ 2019 <strong>yuu</strong>. All Rights Reserved.
                    </div>
                </div>
                <!-- Footer / End -->

            </div>
        </div>
        <!-- Dashboard Content / End -->

    </div>
    <!-- Dashboard Container / End -->

</div>
<!-- Wrapper / End -->


<!-- Scripts
================================================== -->
<script src="/js/jquery-3.3.1.min.js"></script>
<script src="/js/jquery-migrate-3.0.0.min.js"></script>
<script src="/js/mmenu.min.js"></script>
<script src="/js/tippy.all.min.js"></script>
<script src="/js/simplebar.min.js"></script>
<script src="/js/bootstrap-slider.min.js"></script>
<script src="/js/bootstrap-select.min.js"></script>
<script src="/js/snackbar.js"></script>
<script src="/js/clipboard.min.js"></script>
<script src="/js/counterup.min.js"></script>
<script src="/js/magnific-popup.min.js"></script>
<script src="/js/slick.min.js"></script>
<script src="/js/custom.js"></script>
<script src="/js/ajaxfileupload.js"></script>
<script src="/plugins/layer/layer.js"></script>

<!-- 自定义 Script -->
<script>

    // 修改头像
    function updateHeadImg() {
        $.ajaxFileUpload({
            url:'/upload',//用于文件上传的服务器端请求地址
            secureuri:false ,//一般设置为false
            fileElementId:'dropzFile',//文件上传控件的id属性  <input type="file" id="upload" name="upload" />
            dataType: 'text',//返回值类型 一般设置为json
            success: function (responseText)  //服务器成功响应处理函数
            {
                var obj = $.parseJSON(responseText.toString().replace(/<.*?>/ig,""));
                $("#headImg").val(obj.filePath)
                layer.msg('头像上传成功')
            }
        });
    }

    /**
     * 修改验证
     */
    function updateBase() {
        var phone = $("#phone").val()
        // 手机号验证正则表达式
        var phoneReg = /^1[0-9]{10}$/
        if (!phoneReg.test(phone)) {
            layer.msg('手机号格式错误')
            return false
        }
        return true
    }
</script>


</body>
</html>
